package ${project.packageName}.${project.moduleName}.application.service;

import ${project.packageName}.${project.moduleName}.domain.${tableStructure.className}.${tableStructure.classNameUppercase}Entity;
import ${project.packageName}.${project.moduleName}.domain.${tableStructure.className}.repository.${tableStructure.classNameUppercase}Repository;
import ${project.packageName}.${project.moduleName}.domain.${tableStructure.className}.vo.${tableStructure.classNameUppercase}QueryVO;
import com.rabbitpre.tubit.core.page.PageData;
import com.rabbitpre.tubit.core.page.PageParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.InputStream;

/**
 * ${tableStructure.tableComment}应用服务
 *
 * @author ${developer.author}
 * @date ${developer.datetime}
 */
@Service
public class ${tableStructure.classNameUppercase}AppService {

    private static final Logger logger = LoggerFactory.getLogger(${project.packageName}.${project.moduleName}.application.service.${tableStructure.classNameUppercase}AppService.class);


    @Resource
    private ${tableStructure.classNameUppercase}Repository ${tableStructure.className}Repository;

    /**
     * 添加${tableStructure.tableComment}
     *
     * @param ${tableStructure.className}Entity ${tableStructure.tableComment}实体
     * @return boolean
     */
    public boolean add${tableStructure.classNameUppercase}(${tableStructure.classNameUppercase}Entity ${tableStructure.className}Entity) {
        return ${tableStructure.className}Repository.add${tableStructure.classNameUppercase}(${tableStructure.className}Entity);
    }

    /**
     * 添加${tableStructure.tableComment}
     *
     * @param ${tableStructure.className}Id ${tableStructure.tableComment}id
     * @return boolean
     */
    public boolean delete${tableStructure.classNameUppercase}ById(Long ${tableStructure.className}Id) {
        return ${tableStructure.className}Repository.delete${tableStructure.classNameUppercase}ById(${tableStructure.className}Id);
    }

    /**
     * 更新${tableStructure.tableComment}
     *
     * @param ${tableStructure.className}Entity ${tableStructure.tableComment}实体
     * @return boolean
     */
    public boolean update${tableStructure.classNameUppercase}ById(${tableStructure.classNameUppercase}Entity ${tableStructure.className}Entity) {
        return ${tableStructure.className}Repository.update${tableStructure.classNameUppercase}ById(${tableStructure.className}Entity);
    }

    /**
     * 根据${tableStructure.tableComment}id查询${tableStructure.tableComment}
     *
     * @param ${tableStructure.className}Id ${tableStructure.tableComment}id
     * @return ${tableStructure.classNameUppercase}Entity
     */
    public ${tableStructure.classNameUppercase}Entity selectById(Long ${tableStructure.className}Id) {
        return ${tableStructure.className}Repository.selectById(${tableStructure.className}Id);
    }


    /**
     * 根据条件分页查询${tableStructure.tableComment}
     *
     * @param pageParam ${tableStructure.tableComment}分页条件
     * @return List<userDTO>
     */
    public PageData<${tableStructure.classNameUppercase}Entity> queryPageList(${tableStructure.classNameUppercase}QueryVO ${tableStructure.className}QueryVO, PageParam pageParam) {

        PageData<${tableStructure.classNameUppercase}Entity> userDoList = ${tableStructure.className}Repository.queryPageList(${tableStructure.className}QueryVO, pageParam);

        return userDoList;
    }

}
